package ma.co.ba.BusinessApplications.presentation.components;

import java.beans.PropertyEditorSupport;

import ma.co.ba.BusinessApplications.business.profils.ProfilBusiness;
import ma.co.ba.BusinessApplications.model.Profil;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class ProfilEditor extends PropertyEditorSupport {

	@Autowired
    ProfilBusiness profilBusiness;

    // Converts a String to a Profil (when submitting form)
    
	@Override
    public void setAsText(String text) {
        //Country c = this.countryService.findById(Long.valueOf(text));
        Profil prf = this.profilBusiness.getProfilById(Integer.valueOf(text));
		
        this.setValue(prf);
    }
	
}
